package edu.mse.camel.client.session.team;


import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import edu.mse.camel.client.events.AbstractEvent;
import edu.mse.camel.client.events.EventIDs;
import edu.mse.camel.client.events.IEvent;
import edu.mse.camel.client.events.util.Util;

public class QuerySessionParticipantStatus extends AbstractEvent implements IEvent {

	public class ParticipantInternal {
		private String id;
		private String statusDesc;
		private Color color;
		private boolean isFacilitator;
		public boolean isFacilitator() {
			return isFacilitator;
		}
		public void setFacilitator(boolean isFacilitator) {
			this.isFacilitator = isFacilitator;
		}
		public String getId() {
			return id;
		}
		public void setId(String id) {
			this.id = id;
		}
		public String getStatusDesc() {
			return statusDesc;
		}
		public void setStatusDesc(String statusDesc) {
			this.statusDesc = statusDesc;
		}
		public Color getColor() {
			return color;
		}
		public void setColor(Color color) {
			this.color = color;
		}
	}
	
	private List<ParticipantInternal> participants = new ArrayList<ParticipantInternal>();

	public List<ParticipantInternal> getParticipants() {
		return participants;
	}
	
	public List<ITeamMember> getITeamMemberParticipants() {
		List<ITeamMember> teamMemers = new ArrayList<ITeamMember>();
		for (ParticipantInternal iParticipant : participants) {
			ITeamMember aTeamMember = new TeamMember(
					iParticipant.id,
					null,
					TEAMMEMBER_STATUS.SESSION,
					iParticipant.isFacilitator);
			aTeamMember.setColor(Util.getRGB(iParticipant.color));
			teamMemers.add(aTeamMember);
		}
		return teamMemers;
	}
	
	@Override
	public String getEventID() {
		return EventIDs.QUERY_SESSION_PARTICIPANT_STATUS_EVENT;
	}

}
